//
//  S1mpl3FocusCollectionTableViewCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/12.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "S1mpl3FocusCollectionTableViewCell.h"
#import "FitHeader.h"
#import "UIImageView+WebCache.h"
#import "Model.h"

@implementation S1mpl3FocusCollectionTableViewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(void)changeColor{
    self.backgroundColor = [Model shareInstance].ViewColor;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatView];
        [self changeColor];
    }
    return self;
}

-(void)creatView{
    _leftImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_leftImageView];
    
    _rightLabel = [[BaseLabel alloc] init];
    [_rightLabel setFontSize:15];
    [self.contentView addSubview:_rightLabel];
}

-(void)layoutSubviews{
    [super layoutSubviews];
    _leftImageView.frame = CGRectMake(5 * FITWidth, 5 * FITHeight, 90 * FITWidth, 90 * FITHeight);
    
    _rightLabel.frame = CGRectMake(_leftImageView.frame.origin.x + _leftImageView.frame.size.width + 5 * FITWidth, _leftImageView.frame.origin.y, 250 * FITWidth, 40 * FITHeight);
}

-(void)setDic:(NSDictionary *)dic{
    if (_dic != dic) {
        _dic = dic;
    }
    
    [_leftImageView sd_setImageWithURL:[NSURL URLWithString:[dic objectForKey:@"smallLogo"]] placeholderImage:[UIImage imageNamed:@"100*100"]];
    _rightLabel.text = [dic objectForKey:@"nickname"];
    [self changeColor];
}

@end
